package com.wise.site.adapter;


import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;

import com.wise.site.R;
import com.wise.site.protocol.result.Adv;
import com.wise.site.utils.NotifyListener;
import com.wise.site.widget.AdvView;

/*********************************************************
 * @author : zhaohua
 * @version : 2012-8-16
 * @see : 广告图片列表适配器
 * @Copyright : copyrights reserved by personal 2007-2011
 **********************************************************/
public class AdvListAdapter extends ArrayListAdapter<Adv>
{
    private LayoutInflater mInflater;
    private OnClickListener adClick;
    
	public AdvListAdapter(Context context)
    {
        super(context);
        mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent)
    {
        convertView = mInflater.inflate(R.layout.view_image, null);
        AdvView advView = (AdvView)convertView.findViewById(R.id.image);
        advView.setTag((Adv)getItem(position));
        advView.bindData((Adv)getItem(position));
        if(adClick != null){
        	advView.setOnClickListener(adClick);
        }
        return convertView;
    }
    
    public void setAdClick(OnClickListener adClick) {
		this.adClick = adClick;
	}

	@Override
	public void moveToNextPage() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void moveToFristPage() {
		// TODO Auto-generated method stub
		
	}
}
